
#include <BHingeConstraint>
#include "member_BHingeConstraint.h"

using namespace BWE;

#define member						(*(member_BHingeConstraint*)_ptr)
#define member_allocate()			_ptr = new member_BHingeConstraint(this)
#define member_release()			delete (member_BHingeConstraint*)_ptr

BHingeConstraint::BHingeConstraint()
{
	member_allocate();
}
BHingeConstraint::BHingeConstraint(BNode* nodeA, const BVector& pointA, const BVector& axisA)
{
	member_allocate();
	member.axisA = axisA;
}
BHingeConstraint::BHingeConstraint(BNode* nodeA, BNode* nodeB) : BConstraint(nodeA, nodeB)
{
	member_allocate();
}
BHingeConstraint::BHingeConstraint(BNode* nodeA, const BVector& pointA, const BVector& axisA, BNode* nodeB, const BVector& pointB, const BVector& axisB)
	:BConstraint(nodeA, pointA, nodeB, pointB)
{
	member_allocate();
	member.axisA = axisA;
	member.axisB = axisB;
}
BHingeConstraint::~BHingeConstraint()
{
	member_release();
}

void BHingeConstraint::setAxisA(const BVector& axisA)
{
	member.axisA = axisA;
	this->emit(Signal_Changed);
}
const BVector& BHingeConstraint::axisA() const
{
	return member.axisA;
}
void BHingeConstraint::setAxisB(const BVector& axisB)
{
	member.axisB = axisB;
	this->emit(Signal_Changed);
}
const BVector& BHingeConstraint::axisB() const
{
	return member.axisB;
}

void BHingeConstraint::setAngleLimit(const BAngleLimit& angleLimit)
{
	member.angleLimit = angleLimit;
	this->emit(Signal_Changed);
}
const BAngleLimit& BHingeConstraint::angleLimit() const
{
	return member.angleLimit;
}

void BHingeConstraint::setMotorEnabled(bool motorEnabled)
{
	member.motorEnabled = motorEnabled;
	this->emit(Signal_Changed);
}
bool BHingeConstraint::motorEnabled() const
{
	return member.motorEnabled;
}

void BHingeConstraint::setMotorMaxImpulse(BReal maxImpulse)
{
	member.maxImpulse = maxImpulse;
	this->emit(Signal_Changed);
}
BReal BHingeConstraint::motorMaxImpulse() const
{
	return member.maxImpulse;
}

void BHingeConstraint::setMotorTargetVelocity(BReal targetVelocity)
{
	member.targetVelocity = targetVelocity;
	this->emit(Signal_Changed);
}
BReal BHingeConstraint::motorTargetVelocity() const
{
	return member.targetVelocity;
}

void BHingeConstraint::solve()
{

}
